import requests
def login():
# def login(username, password, code):
    session = requests.Session()
    r_code = session.get('http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify')
    # cookie = r_code.cookies
    url = 'http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login&t=0.389993256770355'
    headers = {
        "Contene-Type": "application/x-www-form-urlencoded; charset=UTF-8"
    }
    # data = {
    #     "username": username,
    #     "password": password,
    #     "verify_code": code
    # }
    data = {
        "username": "15879442283",
        "password": "qwer1234",
        "verify_code": "8888"
    }
    res = session.post(url, headers=headers, data=data)
    a = res.json()
    b = a.get('msg')
    return b


print(login())
